<script type="text/javascript">
function selectSelector()
{
    var car_id = '<?php echo $car_id ?>';
    $("#car-selector").val(car_id);
}

$(function(){   
    selectSelector();

    $("#car-selector").change(function() {
        //alert('tes');
        var car_id = $(this).val();
        location.href = "<?php echo base_url() ?>FCar/<?php echo $type ?>/" + car_id;
    });

});
</script>

<div class="car-detail block">
    <div class="car-desc">
        <div class="car-desc-block">
            <div class="container">
                <div class="car-desc-header">
                    <h1>Specification Engine</h1>
                    <a class="btn-find" href="#">Find A <span>Dealer</span></a>
                    <div class="row">
                        <div class="col-md-4">
                        <br><br>
                        Car Selector 
                        <select class="form-control" id="car-selector">
                            <?php 
                                foreach ($query_car->result() as $row) 
                                {
                            ?>
                                    <option value="<?php echo $row->car_id ?>"><?php echo $row->series_name ?></option>
                            <?php
                                }
                            ?>
                        </select>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <?PHP 
        foreach ($query->result() as $row) 
        {
            if($row->style == 'Main Style')
            {
        ?>
        <div class="car-desc-block">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12 col-sm-6 desc-left">
                        <h3><?PHP echo $row->title ?></h3>
                        <p>
                        <?PHP echo $row->content1 ?>
                        </p>
                    </div>
                    <div class="col-xs-12 col-sm-6 desc-right">
                        <img src="<?PHP echo base_url() ?>uploads/car_overview/<?PHP echo $row->image ?>">
                    </div>
                </div>
            </div>
        </div>
        <?PHP
            }
            else if($row->style == '2 Text Style')
            {
        ?>
        <div class="car-desc-block wborder" style="background: url(<?PHP echo base_url() ?>uploads/car_overview/<?PHP echo $row->image ?>) no-repeat; background-size: cover">
            <div class="row reset">
                <div class="panel-left panel-block bg-red-op">
                    <div class="caption">
                        <?PHP echo $row->content1 ?>
                    </div>
                </div>
            </div>
            <div class="row reset">
                <div class="panel-right panel-block bg-red-op">
                    <div class="caption">
                        <?PHP echo $row->content2 ?>
                    </div>
                </div>
            </div>
        </div>
        <?php
            }

            else if($row->style == '3 Text Style')
            {
        ?>
        <div class="car-desc-block wborder" style="background: url(<?PHP echo base_url() ?>uploads/car_overview/<?PHP echo $row->image ?>) no-repeat; background-size: cover">
            <div class="row reset">
                <div class="panel-left panel-block bg-red-op">
                    <div class="caption">
                        <?PHP echo $row->content1 ?>
                    </div>
                </div>
            </div>
            <div class="row reset">
                <div class="panel-right panel-block bg-red-op">
                    <div class="caption">
                        <?PHP echo $row->content2 ?>
                    </div>
                </div>
            </div>
            <div class="row reset">
                <div class="panel-left panel-block bg-red-op">
                    <div class="caption">
                        <?PHP echo $row->content3 ?>                        
                    </div>
                </div>
            </div>
        </div>
        <?PHP
            }
        }
        ?>

    </div>
</div>